<extend name="Public/base" />
<block name="content">
    <div class="row">
        <div class="col-md-12">
            <!-- Horizontal Form -->
            <div class="box box-info">
                <div class="box-header with-border">
                    <h3 class="box-title">{$title}</h3>
                </div>
                <!-- /.box-header -->
                <!-- form start -->
                <form class="form-horizontal" method="post" action="__SELF__" id="ajaxForm01">
                    <div class="box-body">

                        <div class="form-group">
                            <label class="col-sm-2 control-label">角色名字 (required)</label>
                            <div class="col-sm-10">
                                <input class="form-control"  name="role_name"  type="text"  value="{$info.role_name}" placeholder="角色名字"/>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-sm-2 control-label">备注</label>
                            <div class="col-sm-10">
                                <input class="form-control"  name="description"  type="text"  value="{$info.description}" placeholder="备注"/>
                            </div>
                        </div>
                    </div>
                    <!-- /.box-body -->
                    <div class="box-footer">
                        <div class="row">
                            <div class="col-md-offset-4">
                                <notempty name="info.id">
                                    <input type="hidden" name="id" value="{$info.id}"/>
                                </notempty>
                                <button type="reset" class="btn btn-default">取消</button>&nbsp;&nbsp;&nbsp;
                                <input type="submit" class="btn btn-info" value="提交" >
                            </div>
                        </div>

                    </div>
                    <!-- /.box-footer -->
                </form>
            </div>
            <!-- /.box -->
        </div>
    </div>

</block>
<block name="js">
    <script>
        $( document ).ready( function () {
            $("#ajaxForm01").validate({
                rules: {
                    
                        role_id: "required",
                        role_name: "required"
                },
                messages:{
                     
                        role_id: "必填",
                        role_name: "角色名字必填"
                },
                errorElement: "em",
                errorPlacement: function (error, element) {
                    // Add the `help-block` class to the error element
                    error.addClass("help-block");

                    if (element.prop("type") === "checkbox") {
                        error.insertAfter(element.parent("label"));
                    } else {
                        error.insertAfter(element);
                    }
                },
                highlight: function (element, errorClass, validClass) {
                    $(element).parents("div").addClass("has-error").removeClass("has-success");
                },
                unhighlight: function (element, errorClass, validClass) {
                    $(element).parents("div").addClass("has-success").removeClass("has-error");
                }
            });
        })
    </script>
</block>